package view;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import controller.Sistema;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class EliminarLineaTitular extends javax.swing.JFrame {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private EliminarLineaTitular instancia; 
	private JButton Cancelar;
	private JButton Aceptar;
	private JTextField NumeroLinea1;
	private JLabel NumeroLinea;
	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				EliminarLineaTitular inst = new EliminarLineaTitular();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public EliminarLineaTitular() {
		super();
		initGUI();
		instancia=this;
		this.setTitle("Eliminar Linea Titular");
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				NumeroLinea = new JLabel();
				getContentPane().add(NumeroLinea);
				NumeroLinea.setText("Numero Linea");
				NumeroLinea.setBounds(47, 59, 115, 16);
			}
			{
				NumeroLinea1 = new JTextField();
				getContentPane().add(NumeroLinea1);
				NumeroLinea1.setBounds(180, 52, 151, 23);
			}
			{
				Aceptar = new JButton();
				getContentPane().add(Aceptar);
				Aceptar.setText("Aceptar");
				Aceptar.setBounds(88, 120, 92, 29);
				Aceptar.addActionListener(new ActionListener() {
					
					@Override
					public void actionPerformed(ActionEvent arg0) {
						if  (Sistema.getInstance().bajaLinea(Integer.parseInt(NumeroLinea1.getText() ) )==false){
							HelperTest.showMessage("No se pudo eliminar la linea");
						}
						limpiarCampos();	
							
					}

					
				});
			}
			{
				Cancelar = new JButton();
				getContentPane().add(Cancelar);
				Cancelar.setText("Cancelar");
				Cancelar.setBounds(201, 121, 92, 28);
				Cancelar.addActionListener(new ActionListener() {
					
					@Override
					public void actionPerformed(ActionEvent e) {
						Menu app = new Menu();
						app.setLocationRelativeTo(null);
						app.setVisible(true);
						instancia.dispose();
					}
				});
			}
			pack();
			setSize(400, 300);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	private void limpiarCampos() {
		// TODO Auto-generated method stub
		
		NumeroLinea1.setText("");
	}

}
